home *** CD-ROM | disk | FTP | other *** search
- /*****************************************************************************/
- /* (C) 1993,1994 R. NADE - M. GRANDCHAMP - All Rights Reserved */
- /*****************************************************************************/
- /* This source-code is NOT public domain nor Freeware, this is part of */
- /* 'The C Programming Package' which is Shareware. */
- /* If you use this code, please register and get a free Full-VGA version */
- /*****************************************************************************/
- /*----------------*
- * CPPLME10.C *
- * Help manager *
- *----------------*/
-
- /* Included Files */
- # include <stdio.h>
- # include <io.h>
- # include <dos.h>
- # include <fcntl.h>
- # include <bios.h>
- # include <stdlib.h>
- # include <conio.h>
-
- /* Global Variables */
- extern int bm,i,j,k,l,m,n,t,x,x1,x2,xm,y,y1,y2,ym,z,menu0,menu10,return1;
- extern int colour1,colour2,colour3,colour4,colour5,returning;
- extern unsigned char c0,c1,trashcan[];
-
- /*-----------------*
- * GET THE MOUSE10 *
- *-----------------*/
- int get_the_mouse10()
- {
- /* If we make a choice with the mouse */
- /* only available for menu 10 */
- if(ym==1){
- /* we clicked on the first line */
- /* certainly to change of menu */
- x=get_the_mouse0();
- menu0=x; return(-2);
- }
- if((xm>61)&&(xm<80)){
- if(ym==3){
- /* help */
- menu10=1; return(1);
- }
- if(ym==4){
- /* available */
- menu10=2; return(1);
- }
- if(ym==5){
- /* available */
- menu10=3; return(1);
- }
- if(ym==7){
- /* help Files menu */
- menu10=4; return(1);
- }
- if(ym==8){
- /* help menu2 */
- menu10=5; return(1);
- }
- if(ym==9){
- /* help menu3 */
- menu10=6; return(1);
- }
- if(ym==10){
- /* help menu4 */
- menu10=7; return(1);
- }
- if(ym==11){
- /* help menu5 */
- menu10=8; return(1);
- }
- if(ym==12){
- /* help menu6 */
- menu10=9; return(1);
- }
- if(ym==13){
- /* help menu7 */
- menu10=10; return(1);
- }
- if(ym==14){
- /* help menu8 */
- menu10=11; return(1);
- }
- if(ym==15){
- /* help Configuration */
- menu10=12; return(1);
- }
- }
- /* If we clicked outside of the menu zone */
- /* we close the menu */
- menu0=0; return(-2);
- }
- /*---------------*
- * MENU CHOICE10 *
- *---------------*/
- int menu_choice10()
- {
- returning=wait_for_a_key();
- /* Else we pressed a keyboard key. Cf CPPLTC2.C for the */
- /* keyboard test and the returned codes */
- if(returning==-1){
- /* <Esc> we want to return to previous menu */
- menu0=0; return(-2);
- }
- if(returning==40){
- /* <Enter> execute the command */
- return(1);
- }
- if(returning==100){
- /* We pressed a mouse button */
- m=get_the_mouse2(); return(m);
- }
- if(returning==16){
- /* <G> <g> Generalities */
- menu10=1; return(1);
- }
- if(returning==23){
- /* <N> <n> Available */
- menu10=2; return(0);
- }
- if(returning==28){
- /* <S> <s> Available */
- menu10=3; return(0);
- }
- if(returning==15){
- /* <F> <f> Files menu */
- menu10=4; return(1);
- }
- if(returning==2){
- /* <2> Menu2*/
- menu10=5; return(1);
- }
- if(returning==3){
- /* <3> Menu3*/
- menu10=6; return(1);
- }
- if(returning==4){
- /* <4> menu4*/
- menu10=7; return(1);
- }
- if(returning==5){
- /* <5> menu5*/
- menu10=8; return(1);
- }
- if(returning==6){
- /* <6> menu6*/
- menu10=9; return(1);
- }
- if(returning==7){
- /* <7> menu7*/
- menu10=10; return(1);
- }
- if(returning==8){
- /* <8> menu8*/
- menu10=11; return(1);
- }
- if(returning==12){
- /* <C7> <c> menu Configuration */
- menu10=12; return(1);
- }
- /* For the 2-bytes coded keys, this is the second byte */
- if(returning==59){
- /* Function key <F1> = help */
- return(59);
- }
- if(returning>100){
- /* If we pressed Alt + another key to get a menu */
- c1=returning-100; k=get_special_menu00();
- if(k>0) return(-2);
- }
- if((returning==77)||(returning==75)){
- /* Right or Left arrow to change of menu */
- c1=returning; k=get_special_menu00();
- if(k>0) return(-2);
- }
- if(returning==72){
- /* Up arrow */
- if(menu10>1) menu10--;
- else menu10=12;
- return(0);
- }
- if(returning==80){
- /* Down arrow */
- if(menu10<12) menu10++;
- else menu10=1;
- return(0);
- }
- /* Else we return 0 = no choice */
- return(0);
- }
- /*---------------------*
- * DISPLAY MENU LINE10 *
- *---------------------*/
- void display_menu_line10()
- {
- /* First we display the choosen menu 0 */
- textattr(colour5);
- gotoxy(75,1); cputs(" Help ");
- /* Same thing for the selected line */
- if(menu10==1){
- gotoxy(63,3); cputs(" Generalities ");
- }
- if(menu10==2){
- gotoxy(63,4); cputs(" ");
- }
- if(menu10==3){
- gotoxy(63,5); cputs(" ");
- }
- if(menu10==4){
- gotoxy(63,7); cputs(" Files ");
- }
- if(menu10==5){
- gotoxy(63,8); cputs(" menu2 ");
- }
- if(menu10==6){
- gotoxy(63,9); cputs(" menu3 ");
- }
- if(menu10==7){
- gotoxy(63,10); cputs(" menu4 ");
- }
- if(menu10==8){
- gotoxy(63,11); cputs(" menu5 ");
- }
- if(menu10==9){
- gotoxy(63,12); cputs(" menu6 ");
- }
- if(menu10==10){
- gotoxy(63,13); cputs(" menu7 ");
- }
- if(menu10==11){
- gotoxy(63,14); cputs(" menu8 ");
- }
- if(menu10==12){
- gotoxy(63,15); cputs(" Configuration ");
- }
- }
- /*----------------------*
- * DISPLAY KEY LETTER10 *
- *----------------------*/
- void display_key_letter10()
- {
- textattr(116);
- gotoxy(64,3); cputs("G");
- gotoxy(64,4); cputs(" ");
- gotoxy(64,5); cputs(" ");
- gotoxy(64,7); cputs("F");
- gotoxy(68,8); cputs("2");
- gotoxy(68,9); cputs("3");
- gotoxy(68,10); cputs("4");
- gotoxy(68,11); cputs("5");
- gotoxy(68,12); cputs("6");
- gotoxy(68,13); cputs("7");
- gotoxy(68,14); cputs("8");
- gotoxy(64,15); cputs("C");
- }
- /*----------------*
- * DISPLAY MENU10 *
- *----------------*/
- void display_menu10()
- {
- hide_the_mouse(); textattr(colour2);
- gotoxy(61,2); cputs(" ┌────────────────┐ ");
- gotoxy(61,3); cputs(" │ Generalities │ ");
- gotoxy(61,4); cputs(" │ │ ");
- gotoxy(61,5); cputs(" │ │ ");
- gotoxy(61,6); cputs(" ├────────────────┤ ");
- gotoxy(61,7); cputs(" │ Files │ ");
- gotoxy(61,8); cputs(" │ menu2 │ ");
- gotoxy(61,9); cputs(" │ menu3 │ ");
- gotoxy(61,10); cputs(" │ menu4 │ ");
- gotoxy(61,11); cputs(" │ menu5 │ ");
- gotoxy(61,12); cputs(" │ menu6 │ ");
- gotoxy(61,13); cputs(" │ menu7 │ ");
- gotoxy(61,14); cputs(" │ menu8 │ ");
- gotoxy(61,15); cputs(" │ Configuration │ ");
- gotoxy(61,16); cputs(" └────────────────┘ ");
- display_key_letter10(); display_menu_line10();
- show_the_mouse();
- }
- /*----------------*
- * MENU MANAGER10 *
- *----------------*/
- int menu_manager10()
- {
- restore_screen(); return1=0;
- while(1){
- display_menu10(); return1=menu_choice10();
- if(return1==-2) return(-2);
- display_menu10();
- if(return1==1){
- /* we save the help screen and execute the command */
- hide_the_mouse(); save_help_screen();
- show_the_mouse();
- if(menu10==1){
- /* Help about Generalities */
- display_help("GENERALI",0,0,0); restore_help_screen();
- }
- if(menu10==2){
- /* */
-
- }
- if(menu10==3){
- /* */
-
- }
- if(menu10==4){
- /* File menu help */
- display_help("FILES ",5,0,0); restore_help_screen();
- }
- if(menu10==5){
- /* Menu 2 */
- display_help("MENU2 ",21,0,0); restore_help_screen();
- }
- if(menu10==6){
- /* Menu 3 */
- display_help("MENU3 ",32,0,0); restore_help_screen();
- }
- if(menu10==7){
- /* Menu 4 */
- display_help("MENU4 ",43,0,0); restore_help_screen();
- }
- if(menu10==8){
- /* Menu 5 */
- display_help("MENU5 ",54,0,0); restore_help_screen();
- }
- if(menu10==9){
- /* Menu 6 */
- display_help("MENU6 ",65,0,0); restore_help_screen();
- }
- if(menu10==10){
- /* Menu 7 */
- display_help("MENU7 ",76,0,0); restore_help_screen();
- }
- if(menu10==11){
- /* Menu 8 */
- display_help("MENU8 ",87,0,0); restore_help_screen();
- }
- if(menu10==12){
- /* Configuration */
- display_help("CONFIGUR",98,0,0); restore_help_screen();
- }
- }
- }
- }
- /* End of the Module *//*----------------*/
-